/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TimeRecording.reporting;

import TimeRecording.business.SicknessCalculations;
import TimeRecording.enums.PartOfDay;
import TimeRecording.tables.Employee;
import java.awt.Image;
import java.util.Date;

/**
 *
 * @author david
 */
public class SicknessIconProvider extends CalendarIconProvider {

    private static boolean imagesLoaded = false;
    
    protected static Image sickAmIcon;
    protected static Image sickPmIcon;
    protected static Image sickIcon;

    public SicknessIconProvider() {

        super();

        if (!imagesLoaded) {
            sickAmIcon = loadImage("SickAm");
            sickPmIcon = loadImage("SickPm");
            sickIcon = loadImage("SickAllDay");
        }
    }

    public Image getIcon(Employee employee, Date date) {

        PartOfDay sickDay = SicknessCalculations.isSick(employee, date);

        if (sickDay == null) {
            return presentIcon;
        } else {
            switch (sickDay) {
                case ALL_DAY:
                    return sickIcon;
                case AM:
                    return sickAmIcon;
                case PM:
                    return sickPmIcon;
                default:
                    return presentIcon;
            }
        }
    }
}
